﻿using System;
using System.Data;
using System.Configuration;

using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

namespace HZ.DrugTrade.Web
{
    //系统常量定义类
    public class Constants
    {
        //下拉框 全部选项文本以及Value

        /// <summary>
        /// 下拉框 全部选项文本
        /// </summary>
        public const string ALL_ITEM_TEXT = "(全部)";
        /// <summary>
        /// 下拉框 全部选项value
        /// </summary>
        public const string ALL_ITEM_VALUE = "";

        /// <summary>
        /// 默认分页大小
        /// </summary>
        public static int GRIDVIEW_PAGE_SIZE = string.IsNullOrEmpty( ConfigurationManager.AppSettings.Get("GRIDVIEW_PAGE_SIZE"))? 10: int.Parse(ConfigurationManager.AppSettings.Get("GRIDVIEW_PAGE_SIZE"));

        /// <summary>
        /// 系统用户默认密码
        /// </summary>
        public static string USER_DEFAULT_PWS = string.IsNullOrEmpty(ConfigurationManager.AppSettings.Get("USER_DEFAULT_PWS")) ? "999999" : ConfigurationManager.AppSettings.Get("USER_DEFAULT_PWS");
        /// <summary>
        /// 传递ReturnUrl的查询字符串常量
        /// </summary>
        public const string QUERYSTRING_RETURN_URL = "returnUrl";
        ///
        public const string QUERYSTRING_QUERY_CONDITION = "queryCondition";

        public const string VIEWSTATE_QUERY_CONDITION = "__QUERYCONDITION";

        public const bool SYSTEM_URL_PAGING = false;

        /// <summary>
        /// 系统当前部署区域，值为区域ID
        /// </summary>
        public static string CURRENT_DEPLOY_AREAID = string.IsNullOrEmpty(ConfigurationManager.AppSettings.Get("CURRENT_DEPLOY_AREAID")) ? "320000" : ConfigurationManager.AppSettings.Get("CURRENT_DEPLOY_AREAID");


        /// <summary>
        /// 版本号
        /// </summary>
        public static string Version = string.IsNullOrEmpty(ConfigurationManager.AppSettings.Get("Version")) ? "" : ConfigurationManager.AppSettings.Get("Version");

        /// <summary>
        /// 是否校验验证码
        /// </summary>
        public static string IsCheckValidateCode = string.IsNullOrEmpty(ConfigurationManager.AppSettings.Get("IsCheckValidateCode")) ? "" : ConfigurationManager.AppSettings.Get("IsCheckValidateCode");


        /// <summary>
        /// 返回时间字符串，若为1900-01-01则返回空值
        /// </summary>
        /// <returns></returns>
        public static string ReturnTime(DateTime? time)
        {
            string returnValue = "";
            if (time != null)
            {
                string strTime = time.Value.ToString("yyyy-MM-dd");
                if (strTime == "1900-01-01")
                {
                    returnValue = "";
                }
                else
                {
                    returnValue = strTime;
                }
            }
            return returnValue;
        }

    }
}
